]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Check monitor's existence before trying to update the state
authorMario Sanchez Prada <mario@endlessm.com>
Tue, 26 Sep 2017 10:03:33 +0000 (11:03 +0100)
committerMario Sanchez Prada <mario@endlessm.com>
Thu, 28 Sep 2017 15:32:00 +0000 (16:32 +0100)
Not doing this will throw a backtrace when running on headless mode and
trying to show a notification, due to Main.layoutManager.primaryMonitor
being undefined, so it's better to return early.

https://bugzilla.gnome.org/show_bug.cgi?id=730551

js/ui/messageTray.js

index 4704073eb7497b2025a01e0f27b7c1002361dc1d..73e67ebbc3e2c7fea271dfb6b02207bb28139906 100644 (file)
@@ -1205,8 +1205,9 @@ var MessageTray = new Lang.Class({
     // _updateState() figures out what (if anything) needs to be done
     // at the present time.
     _updateState: function() {
-        this.actor.visible = !this._bannerBlocked && this._banner != null;
-        if (this._bannerBlocked)
+        let hasMonitor = Main.layoutManager.primaryMonitor != null;
+        this.actor.visible = !this._bannerBlocked && hasMonitor && this._banner != null;
+        if (this._bannerBlocked || !hasMonitor)
             return;
 
         // If our state changes caused _updateState to be called,